package com.lnking.lnkingplace.datatransjob;


import com.lnking.common.http.ReturnResult;
import com.lnking.lnkingplace.model.request.inspect.InspectSearchRequest;
import com.lnking.lnkingplace.service.IInspectService;
import com.lnking.lnkingplace.service.IRecordUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

/**
 * @author 联坤
 */
@Configuration      //1.主要用于标记配置类，兼备Component的效果。
@EnableScheduling   // 2.开启定时任务
public class Timing {

    @Autowired
    IRecordUserService recordUserService;
//
    //3.添加定时任务  晚上23点
    @Scheduled(cron = "0 0 23 * * ?")
    // 查询即将过期和已过期的核算记录人员的身份证写入前置数据库
    private void configureWrite() {
        System.err.println("执行静态定时任务时间write: " + LocalDateTime.now());
        recordUserService.write();
    }

    //3.添加定时任务  晚上1点
    @Scheduled(cron = "0 0 8 * * ?")
    // 读取前置数据库 写入现有逻辑
    private void configureRead() {
        System.err.println("执行静态定时任务时间read: " + LocalDateTime.now());
        recordUserService.read();
    }

    //3.添加定时任务  晚上1点
    @Scheduled(cron = "0 0 20 * * ?")
    // 读取前置数据库 写入现有逻辑
    private void configureRead1() {
        System.err.println("执行静态定时任务时间read: " + LocalDateTime.now());
        recordUserService.read();
    }
}
